//
//  ZCInvolvedVC.m
//  zctx
//
//  Created by apple on 15/10/12.
//  Copyright © 2015年 sanliang. All rights reserved.
//

#import "ZCInvolvedVC.h"
#import "ZCInvolvedCell.h"
#import "ZCMainModel.h"
#import "ZCInvolvedDetailsVC.h"
@interface ZCInvolvedVC ()

@end

@implementation ZCInvolvedVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.navigationItem setTitle:@"众筹中项目"];
    
    [self.tableView registerNib:[UINib nibWithNibName:@"ZCInvolvedCell" bundle:nil] forCellReuseIdentifier:@"involvedcell"];
    
}

#pragma mark 请求抽样数据
-(void)requestSeeResultdata{
    ProgressHUDStr;
    [NetworkManager requestFoundingGetAllWithType:@"1" mid:UserModel.mid password:UserModel.password mtype:@"0" pagecount:@"0" keywords:@"" success:^(NSArray *array) {
        ProgressDismiss;
        dataArray = array.mutableCopy;
        [self.tableView reloadData];
    } failure:^(NSError *error) {
        ProgressDismiss;
    }];
}



-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString *cellid =@"involvedcell";
    ZCInvolvedCell *cell = [tableView dequeueReusableCellWithIdentifier:cellid];
    if (cell == nil) {
        cell = [[ZCInvolvedCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellid];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    ZCMainModel *moel =[ZCMainModel modelObjectWithDictionary:dataArray[indexPath.row]];
    cell.mainModel = moel;
    
    return cell;
    
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    NSString *mid =[NSString stringWithFormat:@"%@",[dataArray[indexPath.row] objectForKey:@"id"]];
    ZCInvolvedDetailsVC *detailVC = [[ZCInvolvedDetailsVC alloc]init];
    detailVC.pid = mid;
    detailVC.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:detailVC animated:YES];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
